package com.njegovanobradovic.icet.pages;

import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;

import com.njegovanobradovic.icet.facade.Controller;

public class Signin {

	@Property
	@Validate(value = "required")
	private String username;

	@Property
	@Validate(value = "required")
	private String password;

	@Inject
	private Controller controller;

	@Component
	private Form loginForm;

	@Log
	public Object onSubmitFromLoginForm(){
		return controller.userLogin(username, password)? Index.class:Signin.class;
	}

}
